home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / autoba1a / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-24  |  57.0 KB  |  1,682 lines

  1. VERSION 5.00
  2. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  3. Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
  4. Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
  5. Begin VB.Form Form1 
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "Auto Backup"
  8.    ClientHeight    =   5400
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   5940
  12.    Icon            =   "Main.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   5400
  18.    ScaleWidth      =   5940
  19.    StartUpPosition =   2  'CenterScreen
  20.    Begin VB.Timer Timer1 
  21.       Interval        =   59000
  22.       Left            =   0
  23.       Top             =   4920
  24.    End
  25.    Begin VB.CommandButton Command3 
  26.       Cancel          =   -1  'True
  27.       Caption         =   "Minimizar e salvar as      altera
  28. es (ESC)"
  29.       Height          =   495
  30.       Left            =   960
  31.       TabIndex        =   0
  32.       Top             =   4800
  33.       Width           =   1695
  34.    End
  35.    Begin VB.CommandButton Command2 
  36.       Caption         =   "Sair"
  37.       Height          =   495
  38.       Left            =   3360
  39.       TabIndex        =   1
  40.       Top             =   4800
  41.       Width           =   1695
  42.    End
  43.    Begin TabDlg.SSTab SSTab1 
  44.       Height          =   4575
  45.       Left            =   120
  46.       TabIndex        =   2
  47.       Top             =   120
  48.       Width           =   5700
  49.       _ExtentX        =   10054
  50.       _ExtentY        =   8070
  51.       _Version        =   393216
  52.       Style           =   1
  53.       Tabs            =   5
  54.       TabsPerRow      =   5
  55.       TabHeight       =   520
  56.       ShowFocusRect   =   0   'False
  57.       TabCaption(0)   =   "Hora/Dia"
  58.       TabPicture(0)   =   "Main.frx":0E42
  59.       Tab(0).ControlEnabled=   -1  'True
  60.       Tab(0).Control(0)=   "CheckBox4"
  61.       Tab(0).Control(0).Enabled=   0   'False
  62.       Tab(0).Control(1)=   "CheckBox1"
  63.       Tab(0).Control(1).Enabled=   0   'False
  64.       Tab(0).Control(2)=   "Label9"
  65.       Tab(0).Control(2).Enabled=   0   'False
  66.       Tab(0).Control(3)=   "Label4"
  67.       Tab(0).Control(3).Enabled=   0   'False
  68.       Tab(0).Control(4)=   "OptionButton2"
  69.       Tab(0).Control(4).Enabled=   0   'False
  70.       Tab(0).Control(5)=   "Label5"
  71.       Tab(0).Control(5).Enabled=   0   'False
  72.       Tab(0).Control(6)=   "Label6"
  73.       Tab(0).Control(6).Enabled=   0   'False
  74.       Tab(0).Control(7)=   "CheckBox2(1)"
  75.       Tab(0).Control(7).Enabled=   0   'False
  76.       Tab(0).Control(8)=   "CheckBox2(7)"
  77.       Tab(0).Control(8).Enabled=   0   'False
  78.       Tab(0).Control(9)=   "CheckBox2(6)"
  79.       Tab(0).Control(9).Enabled=   0   'False
  80.       Tab(0).Control(10)=   "CheckBox2(5)"
  81.       Tab(0).Control(10).Enabled=   0   'False
  82.       Tab(0).Control(11)=   "CheckBox2(4)"
  83.       Tab(0).Control(11).Enabled=   0   'False
  84.       Tab(0).Control(12)=   "CheckBox2(3)"
  85.       Tab(0).Control(12).Enabled=   0   'False
  86.       Tab(0).Control(13)=   "CheckBox2(2)"
  87.       Tab(0).Control(13).Enabled=   0   'False
  88.       Tab(0).Control(14)=   "OptionButton3"
  89.       Tab(0).Control(14).Enabled=   0   'False
  90.       Tab(0).Control(15)=   "Label8"
  91.       Tab(0).Control(15).Enabled=   0   'False
  92.       Tab(0).Control(16)=   "OptionButton1"
  93.       Tab(0).Control(16).Enabled=   0   'False
  94.       Tab(0).Control(17)=   "Label7"
  95.       Tab(0).Control(17).Enabled=   0   'False
  96.       Tab(0).Control(18)=   "Label3"
  97.       Tab(0).Control(18).Enabled=   0   'False
  98.       Tab(0).Control(19)=   "MaskEdBox2"
  99.       Tab(0).Control(19).Enabled=   0   'False
  100.       Tab(0).Control(20)=   "MaskEdBox1"
  101.       Tab(0).Control(20).Enabled=   0   'False
  102.       Tab(0).Control(21)=   "Command6"
  103.       Tab(0).Control(21).Enabled=   0   'False
  104.       Tab(0).ControlCount=   22
  105.       TabCaption(1)   =   "Arquivos/Diret
  106. rios"
  107.       TabPicture(1)   =   "Main.frx":0E5E
  108.       Tab(1).ControlEnabled=   0   'False
  109.       Tab(1).Control(0)=   "CheckBox3"
  110.       Tab(1).Control(0).Enabled=   0   'False
  111.       Tab(1).Control(1)=   "Label1"
  112.       Tab(1).Control(1).Enabled=   0   'False
  113.       Tab(1).Control(2)=   "Command5"
  114.       Tab(1).Control(2).Enabled=   0   'False
  115.       Tab(1).Control(3)=   "Drive1"
  116.       Tab(1).Control(3).Enabled=   0   'False
  117.       Tab(1).Control(4)=   "Dir1"
  118.       Tab(1).Control(4).Enabled=   0   'False
  119.       Tab(1).Control(5)=   "Command1"
  120.       Tab(1).Control(5).Enabled=   0   'False
  121.       Tab(1).Control(6)=   "List1"
  122.       Tab(1).Control(6).Enabled=   0   'False
  123.       Tab(1).Control(7)=   "Command4"
  124.       Tab(1).Control(7).Enabled=   0   'False
  125.       Tab(1).Control(8)=   "File1"
  126.       Tab(1).Control(8).Enabled=   0   'False
  127.       Tab(1).ControlCount=   9
  128.       TabCaption(2)   =   "Destino"
  129.       TabPicture(2)   =   "Main.frx":0E7A
  130.       Tab(2).ControlEnabled=   0   'False
  131.       Tab(2).Control(0)=   "Label2"
  132.       Tab(2).Control(0).Enabled=   0   'False
  133.       Tab(2).Control(1)=   "Text1"
  134.       Tab(2).Control(1).Enabled=   0   'False
  135.       Tab(2).Control(2)=   "Dir2"
  136.       Tab(2).Control(2).Enabled=   0   'False
  137.       Tab(2).Control(3)=   "Drive2"
  138.       Tab(2).Control(3).Enabled=   0   'False
  139.       Tab(2).ControlCount=   4
  140.       TabCaption(3)   =   "Progresso"
  141.       TabPicture(3)   =   "Main.frx":0E96
  142.       Tab(3).ControlEnabled=   0   'False
  143.       Tab(3).Control(0)=   "Label10"
  144.       Tab(3).Control(0).Enabled=   0   'False
  145.       Tab(3).Control(1)=   "Label11"
  146.       Tab(3).Control(1).Enabled=   0   'False
  147.       Tab(3).Control(2)=   "Label12"
  148.       Tab(3).Control(2).Enabled=   0   'False
  149.       Tab(3).Control(3)=   "Label13"
  150.       Tab(3).Control(3).Enabled=   0   'False
  151.       Tab(3).Control(4)=   "Label14"
  152.       Tab(3).Control(4).Enabled=   0   'False
  153.       Tab(3).Control(5)=   "Command7"
  154.       Tab(3).Control(5).Enabled=   0   'False
  155.       Tab(3).ControlCount=   6
  156.       TabCaption(4)   =   "Sobre"
  157.       TabPicture(4)   =   "Main.frx":0EB2
  158.       Tab(4).ControlEnabled=   0   'False
  159.       Tab(4).Control(0)=   "Label16"
  160.       Tab(4).Control(0).Enabled=   0   'False
  161.       Tab(4).Control(1)=   "Label15"
  162.       Tab(4).Control(1).Enabled=   0   'False
  163.       Tab(4).ControlCount=   2
  164.       Begin VB.CommandButton Command7 
  165.          Caption         =   "Ver arquivo de log..."
  166.          Height          =   495
  167.          Left            =   -73800
  168.          TabIndex        =   43
  169.          Top             =   3720
  170.          Width           =   3255
  171.       End
  172.       Begin VB.FileListBox File1 
  173.          Height          =   1650
  174.          Left            =   -72000
  175.          MultiSelect     =   2  'Extended
  176.          TabIndex        =   15
  177.          Top             =   2040
  178.          Width           =   2535
  179.       End
  180.       Begin VB.CommandButton Command4 
  181.          Caption         =   "+ Diret
  182.          Height          =   375
  183.          Left            =   -73440
  184.          TabIndex        =   14
  185.          Top             =   3885
  186.          Width           =   1215
  187.       End
  188.       Begin VB.ListBox List1 
  189.          Height          =   1230
  190.          ItemData        =   "Main.frx":0ECE
  191.          Left            =   -74880
  192.          List            =   "Main.frx":0ED0
  193.          MultiSelect     =   2  'Extended
  194.          Sorted          =   -1  'True
  195.          TabIndex        =   13
  196.          Top             =   720
  197.          Width           =   5415
  198.       End
  199.       Begin VB.CommandButton Command1 
  200.          Caption         =   "Excluir"
  201.          Height          =   375
  202.          Left            =   -70800
  203.          TabIndex        =   12
  204.          Top             =   3885
  205.          Width           =   1215
  206.       End
  207.       Begin VB.DirListBox Dir1 
  208.          Height          =   1215
  209.          Left            =   -74880
  210.          TabIndex        =   11
  211.          Top             =   2460
  212.          Width           =   2775
  213.       End
  214.       Begin VB.DriveListBox Drive1 
  215.          Height          =   315
  216.          Left            =   -74880
  217.          TabIndex        =   10
  218.          Top             =   2040
  219.          Width           =   2775
  220.       End
  221.       Begin VB.CommandButton Command5 
  222.          Caption         =   "+ Arquivo(s)"
  223.          Height          =   375
  224.          Left            =   -72120
  225.          TabIndex        =   9
  226.          Top             =   3885
  227.          Width           =   1215
  228.       End
  229.       Begin VB.CommandButton Command6 
  230.          Caption         =   "Efetuar backup j
  231.          Height          =   495
  232.          Left            =   3720
  233.          TabIndex        =   8
  234.          Top             =   3780
  235.          Width           =   1695
  236.       End
  237.       Begin VB.DriveListBox Drive2 
  238.          Height          =   315
  239.          Left            =   -73680
  240.          TabIndex        =   5
  241.          Top             =   1200
  242.          Width           =   2895
  243.       End
  244.       Begin VB.DirListBox Dir2 
  245.          Height          =   2565
  246.          Left            =   -73680
  247.          TabIndex        =   4
  248.          Top             =   1680
  249.          Width           =   2895
  250.       End
  251.       Begin VB.TextBox Text1 
  252.          Height          =   285
  253.          Left            =   -74640
  254.          Locked          =   -1  'True
  255.          TabIndex        =   3
  256.          Top             =   720
  257.          Width           =   4935
  258.       End
  259.       Begin MSMask.MaskEdBox MaskEdBox1 
  260.          Height          =   285
  261.          Left            =   1845
  262.          TabIndex        =   6
  263.          TabStop         =   0   'False
  264.          Top             =   930
  265.          Width           =   615
  266.          _ExtentX        =   1085
  267.          _ExtentY        =   503
  268.          _Version        =   393216
  269.          MaxLength       =   5
  270.          Mask            =   "##:##"
  271.          PromptChar      =   "_"
  272.       End
  273.       Begin MSMask.MaskEdBox MaskEdBox2 
  274.          Height          =   285
  275.          Left            =   1845
  276.          TabIndex        =   7
  277.          Top             =   1290
  278.          Width           =   615
  279.          _ExtentX        =   1085
  280.          _ExtentY        =   503
  281.          _Version        =   393216
  282.          MaxLength       =   5
  283.          Mask            =   "##:##"
  284.          PromptChar      =   "_"
  285.       End
  286.       Begin VB.Label Label15 
  287.          AutoSize        =   -1  'True
  288.          Caption         =   "
  289. 1999 Alexandre Moro"
  290.          BeginProperty Font 
  291.             Name            =   "MS Sans Serif"
  292.             Size            =   9.75
  293.             Charset         =   0
  294.             Weight          =   400
  295.             Underline       =   0   'False
  296.             Italic          =   0   'False
  297.             Strikethrough   =   0   'False
  298.          EndProperty
  299.          Height          =   240
  300.          Left            =   -73253
  301.          TabIndex        =   45
  302.          Top             =   1800
  303.          Width           =   2010
  304.       End
  305.       Begin VB.Label Label16 
  306.          Alignment       =   2  'Center
  307.          AutoSize        =   -1  'True
  308.          Caption         =   "Por favor me envie suas sugest
  309. es e coment
  310. rios!"
  311.          BeginProperty Font 
  312.             Name            =   "MS Sans Serif"
  313.             Size            =   8.25
  314.             Charset         =   0
  315.             Weight          =   700
  316.             Underline       =   -1  'True
  317.             Italic          =   0   'False
  318.             Strikethrough   =   0   'False
  319.          EndProperty
  320.          Height          =   195
  321.          Left            =   -74400
  322.          MouseIcon       =   "Main.frx":0ED2
  323.          MousePointer    =   99  'Custom
  324.          TabIndex        =   44
  325.          Top             =   2640
  326.          Width           =   4305
  327.       End
  328.       Begin VB.Label Label14 
  329.          Alignment       =   2  'Center
  330.          Caption         =   " "
  331.          BeginProperty Font 
  332.             Name            =   "MS Sans Serif"
  333.             Size            =   9.75
  334.             Charset         =   0
  335.             Weight          =   400
  336.             Underline       =   0   'False
  337.             Italic          =   0   'False
  338.             Strikethrough   =   0   'False
  339.          EndProperty
  340.          Height          =   600
  341.          Left            =   -74880
  342.          TabIndex        =   42
  343.          Top             =   2880
  344.          Width           =   5400
  345.          WordWrap        =   -1  'True
  346.       End
  347.       Begin VB.Label Label13 
  348.          Alignment       =   2  'Center
  349.          Caption         =   " "
  350.          BeginProperty Font 
  351.             Name            =   "MS Sans Serif"
  352.             Size            =   9.75
  353.             Charset         =   0
  354.             Weight          =   400
  355.             Underline       =   0   'False
  356.             Italic          =   0   'False
  357.             Strikethrough   =   0   'False
  358.          EndProperty
  359.          Height          =   480
  360.          Left            =   -74880
  361.          TabIndex        =   41
  362.          Top             =   2280
  363.          Width           =   5400
  364.          WordWrap        =   -1  'True
  365.       End
  366.       Begin VB.Label Label12 
  367.          Alignment       =   2  'Center
  368.          Caption         =   " "
  369.          BeginProperty Font 
  370.             Name            =   "MS Sans Serif"
  371.             Size            =   9.75
  372.             Charset         =   0
  373.             Weight          =   400
  374.             Underline       =   0   'False
  375.             Italic          =   0   'False
  376.             Strikethrough   =   0   'False
  377.          EndProperty
  378.          Height          =   240
  379.          Left            =   -74880
  380.          TabIndex        =   40
  381.          Top             =   1800
  382.          Width           =   5400
  383.       End
  384.       Begin VB.Label Label11 
  385.          Alignment       =   2  'Center
  386.          Caption         =   " "
  387.          BeginProperty Font 
  388.             Name            =   "MS Sans Serif"
  389.             Size            =   9.75
  390.             Charset         =   0
  391.             Weight          =   400
  392.             Underline       =   0   'False
  393.             Italic          =   0   'False
  394.             Strikethrough   =   0   'False
  395.          EndProperty
  396.          Height          =   480
  397.          Left            =   -74880
  398.          TabIndex        =   39
  399.          Top             =   1200
  400.          Width           =   5400
  401.          WordWrap        =   -1  'True
  402.       End
  403.       Begin VB.Label Label10 
  404.          Alignment       =   2  'Center
  405.          Caption         =   " "
  406.          BeginProperty Font 
  407.             Name            =   "MS Sans Serif"
  408.             Size            =   9.75
  409.             Charset         =   0
  410.             Weight          =   400
  411.             Underline       =   0   'False
  412.             Italic          =   0   'False
  413.             Strikethrough   =   0   'False
  414.          EndProperty
  415.          Height          =   240
  416.          Left            =   -74880
  417.          TabIndex        =   38
  418.          Top             =   720
  419.          Width           =   5400
  420.       End
  421.       Begin VB.Label Label1 
  422.          AutoSize        =   -1  'True
  423.          Caption         =   "Arquivos / Diret
  424. rios a serem copiados (por ordem alfab
  425. tica):"
  426.          Height          =   195
  427.          Left            =   -74880
  428.          TabIndex        =   37
  429.          Top             =   480
  430.          Width           =   4350
  431.       End
  432.       Begin VB.Label Label2 
  433.          AutoSize        =   -1  'True
  434.          Caption         =   "Diret
  435. rio de destino:"
  436.          Height          =   195
  437.          Left            =   -74640
  438.          TabIndex        =   36
  439.          Top             =   480
  440.          Width           =   1410
  441.       End
  442.       Begin VB.Label Label3 
  443.          AutoSize        =   -1  'True
  444.          Caption         =   "Efetuar o backup..."
  445.          Height          =   195
  446.          Left            =   240
  447.          TabIndex        =   35
  448.          Top             =   480
  449.          Width           =   1365
  450.       End
  451.       Begin VB.Label Label7 
  452.          AutoSize        =   -1  'True
  453.          Caption         =   "horas:minutos"
  454.          Height          =   195
  455.          Left            =   2640
  456.          TabIndex        =   34
  457.          Top             =   1335
  458.          Width           =   975
  459.       End
  460.       Begin MSForms.OptionButton OptionButton1 
  461.          Height          =   345
  462.          Left            =   1560
  463.          TabIndex        =   33
  464.          Top             =   900
  465.          Width           =   405
  466.          VariousPropertyBits=   1015023643
  467.          BackColor       =   -2147483633
  468.          ForeColor       =   -2147483630
  469.          DisplayStyle    =   5
  470.          Size            =   "714;609"
  471.          Value           =   "1"
  472.          GroupName       =   "a"
  473.          FontHeight      =   165
  474.          FontCharSet     =   0
  475.          FontPitchAndFamily=   2
  476.       End
  477.       Begin VB.Label Label8 
  478.          AutoSize        =   -1  'True
  479.          Caption         =   "horas:minutos"
  480.          Height          =   195
  481.          Left            =   2640
  482.          TabIndex        =   32
  483.          Top             =   975
  484.          Width           =   975
  485.       End
  486.       Begin MSForms.OptionButton OptionButton3 
  487.          Height          =   345
  488.          Left            =   1560
  489.          TabIndex        =   31
  490.          Top             =   2100
  491.          Width           =   1215
  492.          VariousPropertyBits=   1015023643
  493.          BackColor       =   -2147483633
  494.          ForeColor       =   -2147483630
  495.          DisplayStyle    =   5
  496.          Size            =   "2143;609"
  497.          Value           =   "1"
  498.          Caption         =   "diariamente"
  499.          FontHeight      =   165
  500.          FontCharSet     =   0
  501.          FontPitchAndFamily=   2
  502.       End
  503.       Begin MSForms.CheckBox CheckBox2 
  504.          Height          =   345
  505.          Index           =   2
  506.          Left            =   1560
  507.          TabIndex        =   30
  508.          Top             =   2460
  509.          Width           =   1300
  510.          VariousPropertyBits=   1015023643
  511.          BackColor       =   -2147483633
  512.          ForeColor       =   -2147483630
  513.          DisplayStyle    =   4
  514.          Size            =   "2293;609"
  515.          Value           =   "0"
  516.          Caption         =   "segunda-feira"
  517.          FontHeight      =   165
  518.          FontCharSet     =   0
  519.          FontPitchAndFamily=   2
  520.       End
  521.       Begin MSForms.CheckBox CheckBox2 
  522.          Height          =   345
  523.          Index           =   3
  524.          Left            =   2880
  525.          TabIndex        =   29
  526.          Top             =   2460
  527.          Width           =   1110
  528.          VariousPropertyBits=   1015023643
  529.          BackColor       =   -2147483633
  530.          ForeColor       =   -2147483630
  531.          DisplayStyle    =   4
  532.          Size            =   "1958;609"
  533.          Value           =   "0"
  534.          Caption         =   "ter
  535. a-feira"
  536.          FontHeight      =   165
  537.          FontCharSet     =   0
  538.          FontPitchAndFamily=   2
  539.       End
  540.       Begin MSForms.CheckBox CheckBox2 
  541.          Height          =   345
  542.          Index           =   4
  543.          Left            =   4080
  544.          TabIndex        =   28
  545.          Top             =   2460
  546.          Width           =   1200
  547.          VariousPropertyBits=   1015023643
  548.          BackColor       =   -2147483633
  549.          ForeColor       =   -2147483630
  550.          DisplayStyle    =   4
  551.          Size            =   "2117;609"
  552.          Value           =   "0"
  553.          Caption         =   "quarta-feira"
  554.          FontHeight      =   165
  555.          FontCharSet     =   0
  556.          FontPitchAndFamily=   2
  557.       End
  558.       Begin MSForms.CheckBox CheckBox2 
  559.          Height          =   345
  560.          Index           =   5
  561.          Left            =   1560
  562.          TabIndex        =   27
  563.          Top             =   2820
  564.          Width           =   1185
  565.          VariousPropertyBits=   1015023643
  566.          BackColor       =   -2147483633
  567.          ForeColor       =   -2147483630
  568.          DisplayStyle    =   4
  569.          Size            =   "2090;609"
  570.          Value           =   "0"
  571.          Caption         =   "quinta-feira"
  572.          FontHeight      =   165
  573.          FontCharSet     =   0
  574.          FontPitchAndFamily=   2
  575.       End
  576.       Begin MSForms.CheckBox CheckBox2 
  577.          Height          =   345
  578.          Index           =   6
  579.          Left            =   2880
  580.          TabIndex        =   26
  581.          Top             =   2820
  582.          Width           =   1125
  583.          VariousPropertyBits=   1015023643
  584.          BackColor       =   -2147483633
  585.          ForeColor       =   -2147483630
  586.          DisplayStyle    =   4
  587.          Size            =   "1984;609"
  588.          Value           =   "0"
  589.          Caption         =   "sexta-feira"
  590.          FontHeight      =   165
  591.          FontCharSet     =   0
  592.          FontPitchAndFamily=   2
  593.       End
  594.       Begin MSForms.CheckBox CheckBox2 
  595.          Height          =   345
  596.          Index           =   7
  597.          Left            =   4080
  598.          TabIndex        =   25
  599.          Top             =   2820
  600.          Width           =   930
  601.          VariousPropertyBits=   1015023643
  602.          BackColor       =   -2147483633
  603.          ForeColor       =   -2147483630
  604.          DisplayStyle    =   4
  605.          Size            =   "1640;609"
  606.          Value           =   "0"
  607.          Caption         =   "s
  608. bado"
  609.          FontHeight      =   165
  610.          FontCharSet     =   0
  611.          FontPitchAndFamily=   2
  612.       End
  613.       Begin MSForms.CheckBox CheckBox2 
  614.          Height          =   345
  615.          Index           =   1
  616.          Left            =   1560
  617.          TabIndex        =   24
  618.          Top             =   3180
  619.          Width           =   1005
  620.          VariousPropertyBits=   1015023643
  621.          BackColor       =   -2147483633
  622.          ForeColor       =   -2147483630
  623.          DisplayStyle    =   4
  624.          Size            =   "1773;609"
  625.          Value           =   "0"
  626.          Caption         =   "domingo"
  627.          FontHeight      =   165
  628.          FontCharSet     =   0
  629.          FontPitchAndFamily=   2
  630.       End
  631.       Begin VB.Label Label6 
  632.          AutoSize        =   -1  'True
  633.          Caption         =   "quando:"
  634.          Height          =   195
  635.          Left            =   765
  636.          TabIndex        =   23
  637.          Top             =   2175
  638.          Width           =   585
  639.       End
  640.       Begin VB.Label Label5 
  641.          AutoSize        =   -1  'True
  642.          Caption         =   "sempre 
  643.          Height          =   195
  644.          Left            =   585
  645.          TabIndex        =   22
  646.          Top             =   975
  647.          Width           =   765
  648.       End
  649.       Begin MSForms.OptionButton OptionButton2 
  650.          Height          =   345
  651.          Left            =   1560
  652.          TabIndex        =   21
  653.          Top             =   1260
  654.          Width           =   405
  655.          VariousPropertyBits=   1015023643
  656.          BackColor       =   -2147483633
  657.          ForeColor       =   -2147483630
  658.          DisplayStyle    =   5
  659.          Size            =   "714;609"
  660.          Value           =   "0"
  661.          GroupName       =   "a"
  662.          FontHeight      =   165
  663.          FontCharSet     =   0
  664.          FontPitchAndFamily=   2
  665.       End
  666.       Begin VB.Label Label4 
  667.          AutoSize        =   -1  'True
  668.          Caption         =   "ou a cada:"
  669.          Height          =   195
  670.          Left            =   585
  671.          TabIndex        =   20
  672.          Top             =   1335
  673.          Width           =   765
  674.       End
  675.       Begin VB.Label Label9 
  676.          Alignment       =   2  'Center
  677.          AutoSize        =   -1  'True
  678.          Caption         =   "(intervalo iniciado a partir de agora, ou sempre que o aplicativo for carregado)"
  679.          Height          =   390
  680.          Left            =   1560
  681.          TabIndex        =   19
  682.          Top             =   1620
  683.          Width           =   3420
  684.          WordWrap        =   -1  'True
  685.       End
  686.       Begin MSForms.CheckBox CheckBox1 
  687.          Height          =   345
  688.          Left            =   360
  689.          TabIndex        =   18
  690.          Top             =   3540
  691.          Width           =   1935
  692.          VariousPropertyBits=   1015023643
  693.          BackColor       =   -2147483633
  694.          ForeColor       =   -2147483630
  695.          DisplayStyle    =   4
  696.          Size            =   "3413;609"
  697.          Value           =   "1"
  698.          Caption         =   "Gravar arquivo de log"
  699.          FontHeight      =   165
  700.          FontCharSet     =   0
  701.          FontPitchAndFamily=   2
  702.       End
  703.       Begin MSForms.CheckBox CheckBox3 
  704.          Height          =   495
  705.          Left            =   -74760
  706.          TabIndex        =   17
  707.          Top             =   3825
  708.          Width           =   1215
  709.          BackColor       =   -2147483633
  710.          ForeColor       =   -2147483630
  711.          DisplayStyle    =   4
  712.          Size            =   "2143;873"
  713.          Value           =   "1"
  714.          Caption         =   "Incluir subdiret
  715. rios"
  716.          FontHeight      =   165
  717.          FontCharSet     =   0
  718.          FontPitchAndFamily=   2
  719.       End
  720.       Begin MSForms.CheckBox CheckBox4 
  721.          Height          =   375
  722.          Left            =   360
  723.          TabIndex        =   16
  724.          Top             =   3960
  725.          Width           =   2055
  726.          BackColor       =   -2147483633
  727.          ForeColor       =   -2147483630
  728.          DisplayStyle    =   4
  729.          Size            =   "3625;661"
  730.          Value           =   "0"
  731.          Caption         =   "Backup incremental"
  732.          FontHeight      =   165
  733.          FontCharSet     =   0
  734.          FontPitchAndFamily=   2
  735.       End
  736.    End
  737.    Begin VB.Menu mnu_1 
  738.       Caption         =   "mnu_1"
  739.       Visible         =   0   'False
  740.       Begin VB.Menu MnuRestaurar 
  741.          Caption         =   "Restaurar"
  742.       End
  743.       Begin VB.Menu MnuBackup 
  744.          Caption         =   "Efetuar backup j
  745.       End
  746.       Begin VB.Menu MnuSair 
  747.          Caption         =   "Sair"
  748.       End
  749.    End
  750. Attribute VB_Name = "Form1"
  751. Attribute VB_GlobalNameSpace = False
  752. Attribute VB_Creatable = False
  753. Attribute VB_PredeclaredId = True
  754. Attribute VB_Exposed = False
  755. Option Explicit
  756. Dim NLoops As Integer, LoopDup As Integer, ListaComFoco As Boolean, Days As Byte
  757. Dim sRet As String, Ret As Long, MskErr1 As Boolean, MskErr2 As Boolean
  758. Dim DirDestino As String, SemArqIni As Boolean
  759. Dim WindowsDir As String, NLoopsTimer As Byte, Intervalo As Date, HoraIn
  760. cio As Date
  761. Dim Padr
  762. o As Boolean, 
  763. ltimoBackup As Date, Result As Long, Msg As Long, ErroAbertura As Boolean
  764. Dim XDir(2) As New Collection, FromPath As String
  765. Private Const Arq = "Autobak.ini"
  766. Private Const SW_SHOW = 5
  767. Private Declare Function WritePrivateProfileString& Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As String, ByVal lpFileName As String)
  768. Private Declare Function GetPrivateProfileString& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String)
  769. Private Declare Function GetWindowsDirectory& Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long)
  770. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  771. Private Type NOTIFYICONDATA
  772.     cbSize As Long
  773.     hwnd As Long
  774.     uId As Long
  775.     uFlags As Long
  776.     uCallBackMessage As Long
  777.     hIcon As Long
  778.     szTip As String * 64
  779. End Type
  780. Private Const NIM_ADD = &H0
  781. Private Const NIM_MODIFY = &H1
  782. Private Const NIM_DELETE = &H2
  783. Private Const NIF_MESSAGE = &H1
  784. Private Const NIF_ICON = &H2
  785. Private Const NIF_TIP = &H4
  786. Private Const WM_MOUSEMOVE = &H200
  787. Private Const WM_LBUTTONDOWN = &H201
  788. Private Const WM_LBUTTONUP = &H202
  789. Private Const WM_LBUTTONDBLCLK = &H203
  790. Private Const WM_RBUTTONDOWN = &H204
  791. Private Const WM_RBUTTONUP = &H205
  792. Private Const WM_RBUTTONDBLCLK = &H206
  793. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
  794. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
  795. Private nid As NOTIFYICONDATA
  796. Private Type ListaArqs
  797.     Nome As String
  798.     Tamanho As Long
  799. End Type
  800. Private Arquivos() As ListaArqs
  801. Private Sub GetDirs(Path As String)
  802.     'on error Resume Next
  803.     Dim vDirName As String, LastDir As String
  804.     Dim i As Integer
  805.     'Adjust so No Deletion of Drive
  806.     If Len(Path$) < 4 Then Exit Sub
  807.     If Right(Path$, 1) <> "\" Then
  808.         XDir(0).Add Path$
  809.         Path$ = Path$ & "\"
  810.     End If
  811.     vDirName = Dir(Path, vbDirectory) ' Retrieve the first entry.
  812.     Do While vDirName <> ""
  813.         If vDirName <> "." And vDirName <> ".." Then
  814.             If (GetAttr(Path & vDirName)) = vbDirectory Then
  815.                 LastDir = vDirName
  816.                 'Finds Directory Name then Repeats
  817.                 GetDirs (Path$ & vDirName)
  818.                 vDirName = Dir(Path$, vbDirectory)
  819.                 Do Until vDirName = LastDir Or vDirName = ""
  820.                     vDirName = Dir
  821.                 Loop
  822.                 If vDirName = "" Then Exit Do
  823.             End If
  824.         End If
  825.     vDirName = Dir
  826.     Loop
  827. End Sub
  828. Private Function ExtractText(FullText As String, token As String, Optional StartAtLeft = True, Optional IncludeLeftSide = True) As String
  829. 'ExtractText(Path$, ":", False, False)
  830.     Dim i As Integer
  831.     If StartAtLeft = True And IncludeLeftSide = True Then
  832.         ExtractText = FullText
  833.         For i = 1 To Len(FullText)
  834.             If Mid(FullText, i, 1) = token Then
  835.                 ExtractText = Left(FullText, i - 1)
  836.                 Exit Function
  837.             End If
  838.         Next
  839.     ElseIf StartAtLeft = True And IncludeLeftSide = False Then
  840.         ExtractText = FullText
  841.         For i = 1 To Len(FullText)
  842.             If Mid(FullText, i, 1) = token Then
  843.                 ExtractText = Right(FullText, Len(FullText) - i)
  844.                 Exit Function
  845.             End If
  846.         Next
  847.     ElseIf StartAtLeft = False And IncludeLeftSide = True Then
  848.         ExtractText = ""
  849.         For i = Len(FullText) To 1 Step -1
  850.             If Mid(FullText, i, 1) = token Then
  851.                 ExtractText = Left(FullText, i - 1)
  852.                 Exit Function
  853.             End If
  854.         Next
  855.     ElseIf StartAtLeft = False And IncludeLeftSide = False Then
  856.         ExtractText = ""
  857.         For i = Len(FullText) To 1 Step -1
  858.             If Mid(FullText, i, 1) = token Then
  859.                 ExtractText = Right(FullText, Len(FullText) - i)
  860.                 Exit Function
  861.             End If
  862.         Next
  863.     End If
  864. End Function
  865. Private Sub MtxAdicionaArq(CamCompleto As String)
  866.     If UBound(Arquivos) = 1 Then
  867.         Arquivos(1).Nome = CamCompleto
  868.         Arquivos(1).Tamanho = FileLen(CamCompleto)
  869.         ReDim Preserve Arquivos(2)
  870.     Else
  871.         Arquivos(UBound(Arquivos)).Nome = CamCompleto
  872.         Arquivos(UBound(Arquivos)).Tamanho = FileLen(CamCompleto)
  873.         ReDim Preserve Arquivos(UBound(Arquivos) + 1)
  874.     End If
  875. End Sub
  876. Private Sub MtxAdicionaDir(ByVal Caminho As String)
  877. On Error GoTo erro
  878.     Dim B As String, n As Integer, CaminhoCurto As String
  879.     If Not Right(Caminho, 1) = "*" Then Caminho = Caminho & "*.*"
  880.     CaminhoCurto = Left(Caminho, Len(Caminho) - 3)
  881.             
  882.     If Not UBound(Arquivos) = 1 Then
  883.         n = UBound(Arquivos) + 1
  884.         ReDim Preserve Arquivos(n)
  885.     End If
  886.     B = Dir(Caminho)
  887.     If B = "" Then
  888.         Exit Sub
  889.     Else
  890.         Arquivos(UBound(Arquivos) - 1).Nome = CaminhoCurto & B
  891.         Arquivos(UBound(Arquivos) - 1).Tamanho = FileLen(CaminhoCurto & B)
  892.     End If
  893.     Do
  894.     B = Dir
  895.     If B = "" Then Exit Do
  896.         
  897.     With Arquivos(n)
  898.         .Nome = CaminhoCurto & B
  899.         .Tamanho = FileLen(CaminhoCurto & B)
  900.     End With
  901.     n = n + 1
  902.     ReDim Preserve Arquivos(n)
  903.     Loop
  904.     Exit Sub
  905. erro:
  906.     MsgBox "MtxAdicionaDir:" & vbLf & vbLf & Err.Number & ":" & Err.Description, vbCritical
  907.     Resume sa
  908. End Sub
  909. Private Sub AdicionaItem(OnlyFile As Boolean, Optional WithSubs As Boolean = False)
  910. On Error GoTo erro
  911.     Screen.MousePointer = vbHourglass
  912.     Dim AddPath As String
  913.     If Right(Dir1.Path, 1) = "\" Then
  914.         AddPath = Dir1.Path
  915.     Else
  916.         AddPath = Dir1.Path & "\"
  917.     End If
  918.     If Not OnlyFile Then
  919.         
  920.         If WithSubs Then
  921.             Dim i As Integer, d As String
  922.             GetDirs (AddPath)
  923.             For i = 1 To XDir(0).Count
  924.                 If VerificaDup(XDir(0).Item(i) & "\*.*") Then
  925.                     MsgBox "Este 
  926. tem j
  927.  existe na lista:" & vbLf & vbLf & XDir(0).Item(i) & "\*.*", vbExclamation
  928.                 Else
  929.                     List1.AddItem XDir(0).Item(i) & "\*.*"
  930.                 End If
  931.             Next i
  932.             For i = XDir(0).Count To 1 Step -1
  933.                 XDir(0).Remove (i)
  934.             Next i
  935.         End If
  936.         
  937.         If List1.ListCount = 0 Then
  938.             List1.AddItem AddPath & "*.*"
  939.             GoTo sa
  940.         Else
  941.             If VerificaDup(AddPath & "*.*") Then
  942.                 MsgBox "Este 
  943. tem j
  944.  existe na lista:" & vbLf & vbLf & AddPath & "*.*", vbExclamation
  945.                 GoTo sa
  946.             Else
  947.                 List1.AddItem AddPath & "*.*"
  948.                 GoTo sa
  949.             End If
  950.         End If
  951.         
  952.     Else
  953.         Dim Entries As Integer
  954.         For NLoops = 0 To File1.ListCount - 1
  955.             If File1.Selected(NLoops) Then
  956.                 Entries = Entries + 1
  957.                 If Entries > 1 Then GoTo cont
  958.             End If
  959.         Next NLoops
  960. cont:
  961.         If Entries = 1 Then
  962.             If VerificaDup(AddPath & File1.FileName) Then
  963.                 MsgBox "Este 
  964. tem j
  965.  existe na lista:" & vbLf & vbLf & AddPath & File1.FileName, vbExclamation
  966.                 GoTo sa
  967.             Else
  968.                 List1.AddItem AddPath & File1.FileName
  969.                 GoTo sa
  970.             End If
  971.         ElseIf Entries > 1 Then
  972.             For NLoops = 0 To File1.ListCount - 1
  973.                 If File1.Selected(NLoops) Then
  974.                     If VerificaDup(AddPath & File1.List(NLoops)) Then
  975.                         MsgBox "Este 
  976. tem j
  977.  existe na lista:" & vbLf & vbLf & AddPath & File1.List(NLoops), vbExclamation
  978.                     Else
  979.                         List1.AddItem AddPath & File1.List(NLoops)
  980.                     End If
  981.                 End If
  982.             Next NLoops
  983.         End If
  984.         
  985.     End If
  986.     Screen.MousePointer = vbDefault
  987.     Exit Sub
  988. erro:
  989.     MsgBox Err.Number & vbLf & Err.Description, vbCritical
  990.     Resume sa
  991.                     
  992. End Sub
  993. Private Sub Backup()
  994. On Error GoTo erro
  995.     Screen.MousePointer = vbHourglass
  996.     Dim DateBak As Date, TimeBak As Date, ErrString As String
  997.     Dim NDirs As Integer, File As String, TskID As Double, TotArquivos As Long, TotArquivosCopiados As Long
  998.     Dim ErroDest As Byte, ArqAtr As Byte, Tam As Long
  999.         
  1000.     SSTab1.Tab = 3
  1001.     TimeBak = Now
  1002.     DateBak = Date
  1003.     Me.Caption = "Gerando lista de arquivos..."
  1004.     If Not Right(DirDestino, 1) = "\" Then DirDestino = DirDestino & "\"
  1005.     For NLoops = 0 To List1.ListCount - 1
  1006.         If Right(List1.List(NLoops), 1) = "*" Then
  1007.             MtxAdicionaDir (Left(List1.List(NLoops), Len(List1.List(NLoops)) - 3))
  1008.         Else
  1009.             MtxAdicionaArq (List1.List(NLoops))
  1010.         End If
  1011.     Next NLoops
  1012.     Me.Caption = "Efetuando backup..."
  1013.     If CheckBox1 Then
  1014.         Open WindowsDir & "Log Autobak.txt" For Output As #1
  1015.         Print #1, "Iniciando backup 
  1016. s " & Now
  1017.         Print #1,
  1018.     End If
  1019.     Label10.Caption = "Copiando agora"
  1020.     Label12.Caption = "para"
  1021.     TotArquivos = UBound(Arquivos) - 1
  1022.     For NLoops = 0 To TotArquivos
  1023.         DoEvents
  1024.         If Not Arquivos(NLoops).Nome = "" Then
  1025.             ArqAtr = GetAttr(Arquivos(NLoops).Nome)
  1026.             Label11.Caption = Arquivos(NLoops).Nome
  1027.             Label13.Caption = DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome)
  1028.             Label14.Caption = "Arquivo " & NLoops & " de " & TotArquivos
  1029. cont:
  1030.             If CheckBox4 Then
  1031.                 If ArqAtr And vbArchive <> 0 Then
  1032.                     If CheckBox1 Then Print #1, Arquivos(NLoops).Nome & " --> " & DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) & ", status: ";
  1033.                     FileCopy Arquivos(NLoops).Nome, DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome)
  1034.                     SetAttr Arquivos(NLoops).Nome, (ArqAtr - vbArchive)
  1035.                     If CheckBox1 Then Print #1, "Ok!"
  1036.                     Tam = Tam + FileLen(Arquivos(NLoops).Nome)
  1037.                     TotArquivosCopiados = TotArquivosCopiados + 1
  1038.                 End If
  1039.             Else
  1040.                 If CheckBox1 Then Print #1, Arquivos(NLoops).Nome & " --> " & DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) & ", status: ";
  1041.                 FileCopy Arquivos(NLoops).Nome, DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome)
  1042.                 If CheckBox1 Then Print #1, "Ok!"
  1043.                 Tam = Tam + FileLen(Arquivos(NLoops).Nome)
  1044.                 TotArquivosCopiados = TotArquivosCopiados + 1
  1045.             End If
  1046.             Label14.Caption = "Arquivo " & NLoops & " de " & TotArquivos & ", total: " & _
  1047.                         Format(Tam / 1024 / 1024, "standard") & " Mb"
  1048.         End If
  1049.     Next NLoops
  1050.     If CheckBox1 Then
  1051.         Print #1,
  1052.         Print #1, "Copiados " & TotArquivosCopiados & " arquivos, " & Format(Tam / 1024 / 1024, "standard") & " Mb, das " & _
  1053.             Format(TimeBak, "short time") & " 
  1054. s " & Format(Time, "short time") & " de " & _
  1055.             Format(DateBak, "short date") & "."
  1056.         Close #1
  1057.     End If
  1058.     Label10.Caption = ""
  1059.     Label11.Caption = ""
  1060.     Label12.Caption = ""
  1061.     Label13.Caption = ""
  1062.     Label14.Caption = "Copiados " & TotArquivosCopiados & " arquivos, " & Format(Tam / 1024 / 1024, "standard") & " Mb, das " & _
  1063.         Format(TimeBak, "short time") & " 
  1064. s " & Format(Time, "short time") & " de " & _
  1065.         Format(DateBak, "short date") & "."
  1066.     ReDim Arquivos(0)
  1067.     Me.Caption = "Auto Backup"
  1068.     Screen.MousePointer = vbDefault
  1069.     Exit Sub
  1070. erro:
  1071.     ErrString = vbLf & vbLf & "Enquanto tentava copiar:" & vbLf & Arquivos(NLoops).Nome & _
  1072.         vbLf & "para" & vbLf & DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome) & vbLf & _
  1073.         vbLf & "Tentar novamente?"
  1074.     If CheckBox1 Then Print #1, "ERRO: " & Err.Number & " - " & Err.Description;
  1075.     Select Case Err.Number
  1076.         
  1077.         Case 5      'Invalid procedure call
  1078.             Resume Next
  1079.                     
  1080.         Case 52    'Bad filename
  1081.             MsgBox "Nome de arquivo inv
  1082. lido! (erro 52)" & vbLf & vbLf & Arquivos(NLoops).Nome, vbExclamation
  1083.             Resume Next
  1084.             
  1085.         Case 53     'File not found
  1086.             MsgBox "Arquivo n
  1087. o encontrado! (erro 53)" & vbLf & vbLf & Arquivos(NLoops).Nome, vbExclamation
  1088.             Resume Next
  1089.                     
  1090.         Case 57     'Device I/O error
  1091.             If MsgBox("O disco de destino n
  1092. o est
  1093.  pronto! (erro 57)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1094.             
  1095.         Case 61     'Disk full
  1096.             If MsgBox("Drive de destino cheio! (erro 61)" & ErrString, vbExclamation + vbYesNo) = vbYes Then Resume cont
  1097.                     
  1098.         Case 70    'Permission denied
  1099.             If MsgBox("Diret
  1100. rio ou drive de destino protegido! (erro 70)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1101.             
  1102.         Case 71    'Disk not ready
  1103.             If MsgBox("O disco de destino n
  1104. o est
  1105.  pronto! (erro 71)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1106.                 
  1107.         Case 75     'Path/file access error
  1108.             SetAttr DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome), (GetAttr(DirDestino & RetornaNomeArq(Arquivos(NLoops).Nome)) - vbReadOnly)
  1109.             Resume cont
  1110.         
  1111.         Case 76     'Path not found
  1112.             If MsgBox("Diret
  1113. rio de destino inexistente! (erro 76)" & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1114.         
  1115.         Case Else
  1116.             If MsgBox("Erro imprevisto!" & vbLf & vbLf & Err.Number & ": " & Err.Description & ErrString, vbCritical + vbYesNo) = vbYes Then Resume cont
  1117.     End Select
  1118.     Resume sa
  1119. End Sub
  1120. Private Function RetornaNomeArq(ByVal Arq As String) As String
  1121. 'Arq 
  1122.  o caminho completo, retorna o arquivo
  1123.     Dim n As Integer
  1124.     For n = Len(Arq) To 1 Step -1
  1125.         If Mid(Arq, n, 1) = "\" Then
  1126.             RetornaNomeArq = Right(Arq, Len(Arq) - n)
  1127.             Exit Function
  1128.         End If
  1129.     Next n
  1130. End Function
  1131. Private Sub ChecaHora()
  1132. On Error GoTo erro
  1133.     If OptionButton1 And Not HoraIn
  1134. cio = vbEmpty Then
  1135.         If HoraIn
  1136. cio = TimeSerial(Hour(Time), Minute(Time), 0) Then
  1137.             Me.Caption = "Realizando Backup..."
  1138.             Me.Refresh
  1139.             Backup
  1140.             
  1141. ltimoBackup = TimeSerial(Hour(Time), Minute(Time), 0)
  1142.             Me.Caption = "Auto Backup"
  1143.             Me.Refresh
  1144.         End If
  1145.     End If
  1146.     If OptionButton2 And Not Intervalo = vbEmpty Then
  1147.         If TimeSerial(Hour(Time), Minute(Time), 0) = TimeValue(Intervalo + 
  1148. ltimoBackup) Then
  1149.             Me.Caption = "Realizando Backup..."
  1150.             Me.Refresh
  1151.             Backup
  1152.             
  1153. ltimoBackup = TimeSerial(Hour(Time), Minute(Time), 0)
  1154.             Me.Caption = "Auto Backup"
  1155.             Me.Refresh
  1156.         End If
  1157.     End If
  1158.     Exit Sub
  1159. erro:
  1160.     If Not Err.Number = 13 Then MsgBox Err.Number & vbLf & Err.Description
  1161.     Resume sa
  1162. End Sub
  1163. Private Sub Inicializa()
  1164. On Error GoTo erro
  1165.     Dim Lenght As Byte
  1166.     WindowsDir = String(255, 0)
  1167.     Lenght = GetWindowsDirectory(WindowsDir, 254)
  1168.     WindowsDir = Left(WindowsDir, Lenght)
  1169.     If Not Right(WindowsDir, 1) = "\" Then WindowsDir = WindowsDir & "\"
  1170.     If Dir(WindowsDir & "Autobak.ini") = "" Then
  1171.         If Dir(WindowsDir & "Autobak.bak") <> "" Then
  1172.             FileCopy WindowsDir & "Autobak.bak", WindowsDir & "Autobak.ini"
  1173.         Else
  1174.             SemArqIni = True
  1175.         End If
  1176.     End If
  1177.         
  1178.     sRet = String(255, 0)
  1179.     Ret = GetPrivateProfileString("Quando", "Sempre
  1180. s", "", sRet, 255, Arq)
  1181.     sRet = Left(sRet, Ret)
  1182.     If Not Ret = 0 Then
  1183.         If sRet = "???" Then
  1184.             HoraIn
  1185. cio = vbEmpty
  1186.         Else
  1187.             MaskEdBox1.Text = sRet
  1188.             HoraIn
  1189. cio = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0)
  1190.         End If
  1191.     End If
  1192.     sRet = String(255, 0)
  1193.     Ret = GetPrivateProfileString("Quando", "ACada", "", sRet, 255, Arq)
  1194.     sRet = Left(sRet, Ret)
  1195.     If Not Ret = 0 Then
  1196.         If sRet = "???" Then
  1197.             Intervalo = vbEmpty
  1198.         Else
  1199.             MaskEdBox2.Text = sRet
  1200.             Intervalo = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0)
  1201.         End If
  1202.     End If
  1203.     sRet = String(255, 0)
  1204.     Ret = GetPrivateProfileString("Quando", "Padr
  1205. o", "", sRet, 255, Arq)
  1206.     sRet = Left(sRet, Ret)
  1207.     If Not Ret = 0 Then
  1208.         If sRet = "False" Then
  1209.             Padr
  1210. o = False
  1211.         Else
  1212.             Padr
  1213. o = True
  1214.         End If
  1215.     End If
  1216.     sRet = String(255, 0)
  1217.     Ret = GetPrivateProfileString("Quando", "Dias", "", sRet, 255, Arq)
  1218.     sRet = Left(sRet, Ret)
  1219.     If Not Ret = 0 Then
  1220.         Dim BsRet As Byte
  1221.         BsRet = CByte(sRet)
  1222.         If Int(BsRet / 64) = 1 Then CheckBox2(7).Value = True: BsRet = BsRet - 64
  1223.         If Int(BsRet / 32) = 1 Then CheckBox2(6).Value = True: BsRet = BsRet - 32
  1224.         If Int(BsRet / 16) = 1 Then CheckBox2(5).Value = True: BsRet = BsRet - 16
  1225.         If Int(BsRet / 8) = 1 Then CheckBox2(4).Value = True: BsRet = BsRet - 8
  1226.         If Int(BsRet / 4) = 1 Then CheckBox2(3).Value = True: BsRet = BsRet - 4
  1227.         If Int(BsRet / 2) = 1 Then CheckBox2(2).Value = True: BsRet = BsRet - 2
  1228.         If Int(BsRet / 1) = 1 Then CheckBox2(1).Value = True
  1229.     End If
  1230.     sRet = String(255, 0)
  1231.     Ret = GetPrivateProfileString("Log", "Gravar", "", sRet, 255, Arq)
  1232.     sRet = Left(sRet, Ret)
  1233.     If Not Ret = 0 Then If sRet = "N
  1234. o" Then CheckBox1.Value = False
  1235.     sRet = String(255, 0)
  1236.     Ret = GetPrivateProfileString("Backup", "Incremental", "", sRet, 255, Arq)
  1237.     sRet = Left(sRet, Ret)
  1238.     If Not Ret = 0 Then If sRet = "Sim" Then CheckBox4.Value = True
  1239.     sRet = String(255, 0)
  1240.     Ret = GetPrivateProfileString("Destino", "Dir", "", sRet, 255, Arq)
  1241.     sRet = Left(sRet, Ret)
  1242.     If Not Ret = 0 Then
  1243.         On Error GoTo erro1
  1244.         Dir2.Path = sRet
  1245.         Drive2.Drive = Left(sRet, 2)
  1246.         On Error GoTo erro
  1247.     End If
  1248. cont:
  1249.     DirDestino = sRet
  1250.     Text1.Text = DirDestino
  1251.     NLoops = 0
  1252.     ReDim Arquivos(0)
  1253. start:
  1254.     sRet = String(255, 0)
  1255.     Ret = GetPrivateProfileString("Entradas", NLoops, "", sRet, 255, Arq)
  1256.     If Ret = 0 Then 
  1257. ltimoBackup = TimeSerial(Hour(Time), Minute(Time), 0): Exit Sub
  1258.     sRet = Left(sRet, Ret)
  1259.     List1.AddItem sRet
  1260.     NLoops = NLoops + 1
  1261.     GoTo start
  1262.     Exit Sub
  1263. erro:
  1264.     MsgBox Err.Number & vbLf & vbLf & Err.Description, vbCritical, "Initializing!"
  1265.     Resume Next
  1266. erro1:
  1267.     If Err.Number = 68 Or Err.Number = 76 Then
  1268.         'MsgBox "O diret
  1269. rio ou drive de destino n
  1270. o est
  1271.  dispon
  1272. vel!" & vbLf & vbLf & _
  1273.             "Deixado como padr
  1274. o ""C:\""", vbExclamation
  1275.         'sRet = "C:\"
  1276.     Else
  1277.         MsgBox Err.Number & vbLf & Err.Description
  1278.     End If
  1279.     Resume cont
  1280. End Sub
  1281. Private Sub SalvaAltera
  1282. On Error GoTo erro
  1283.     Screen.MousePointer = vbHourglass
  1284.         
  1285.     On Error Resume Next
  1286.     Name WindowsDir & Arq As WindowsDir & "Autobak.bak"
  1287.     Kill WindowsDir & Arq
  1288.     On Error GoTo erro
  1289.     If Not MaskEdBox1.Text = "__:__" Then
  1290.         Call WritePrivateProfileString("Quando", "Sempre
  1291. s", MaskEdBox1.Text, Arq)
  1292.         HoraIn
  1293. cio = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0)
  1294.     Else
  1295.         Call WritePrivateProfileString("Quando", "Sempre
  1296. s", "???", Arq)
  1297.         HoraIn
  1298. cio = vbEmpty
  1299.     End If
  1300.     If Not MaskEdBox2.Text = "__:__" Then
  1301.         Call WritePrivateProfileString("Quando", "ACada", MaskEdBox2.Text, Arq)
  1302.         Intervalo = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0)
  1303.     Else
  1304.         Call WritePrivateProfileString("Quando", "ACada", "???", Arq)
  1305.         Intervalo = vbEmpty
  1306.     End If
  1307.     If OptionButton1 Then
  1308.         Call WritePrivateProfileString("Quando", "Padr
  1309. o", False, Arq)
  1310.     Else
  1311.         Call WritePrivateProfileString("Quando", "Padr
  1312. o", True, Arq)
  1313.     End If
  1314.     If OptionButton3 Then
  1315.         Call WritePrivateProfileString("Quando", "Dias", "0", Arq)
  1316.     Else
  1317.         Days = 0
  1318.         Dim n As Byte
  1319.         For n = 0 To 6
  1320.             If CheckBox2(n + 1) Then Days = Days + 2 ^ n
  1321.         Next n
  1322.         Call WritePrivateProfileString("Quando", "Dias", Days, Arq)
  1323.     End If
  1324.             
  1325.     If CheckBox1 Then
  1326.         Call WritePrivateProfileString("Log", "Gravar", "Sim", Arq)
  1327.     Else
  1328.         Call WritePrivateProfileString("Log", "Gravar", "N
  1329. o", Arq)
  1330.     End If
  1331.             
  1332.     If CheckBox4 Then
  1333.         Call WritePrivateProfileString("Backup", "Incremental", "Sim", Arq)
  1334.     Else
  1335.         Call WritePrivateProfileString("Backup", "Incremental", "N
  1336. o", Arq)
  1337.     End If
  1338.             
  1339.     Call WritePrivateProfileString("Destino", "Dir", Text1.Text, Arq)
  1340.     For NLoops = 0 To List1.ListCount - 1
  1341.         If WritePrivateProfileString("Entradas", CStr(NLoops), List1.List(NLoops), Arq) = 0 Then
  1342.             MsgBox "Arquivo .INI cheio." & vbLf & "
  1343. ltima entrada salva: " & List1.List(NLoops - 1), vbCritical
  1344.             GoTo sa
  1345.         End If
  1346.     Next NLoops
  1347.     Screen.MousePointer = vbDefault
  1348.     Me.WindowState = vbMinimized
  1349.     Exit Sub
  1350. erro:
  1351.     MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1352.     Resume sa
  1353. End Sub
  1354. Private Function VerificaDup(Item As String) As Boolean
  1355.     For LoopDup = 0 To List1.ListCount - 1
  1356.         If List1.List(LoopDup) = Item Then
  1357.             VerificaDup = True
  1358.             Exit Function
  1359.         End If
  1360.     Next LoopDup
  1361.     VerificaDup = False
  1362. End Function
  1363. Private Function VerificaErros() As Boolean
  1364.     If List1.ListCount = 0 Then
  1365.         MsgBox "Voc
  1366.  precisa especificar pelo menos um arquivo ou diret
  1367. rio para o backup!", vbCritical
  1368.         SSTab1.Tab = 1
  1369.         GoTo erro
  1370.     End If
  1371.     If Len(Text1.Text) = 0 Then
  1372.         MsgBox "Voc
  1373.  precisa especificar o diret
  1374. rio de destino.", vbCritical
  1375.         SSTab1.Tab = 2
  1376.         Text1.SetFocus
  1377.         GoTo erro
  1378.     ElseIf Text1.Text = "c:\" Or Text1.Text = "C:\" Then
  1379.         If MsgBox("O diret
  1380. rio de destino foi deixado como C:\." & vbLf & vbLf & "Confirma?", _
  1381.             vbYesNo + vbExclamation) = vbNo Then
  1382.             SSTab1.Tab = 2
  1383.             Text1.SetFocus
  1384.             GoTo erro
  1385.         End If
  1386.     ElseIf OptionButton1 And MaskEdBox1.Text = "__:__" Then
  1387.         MsgBox "Voc
  1388.  precisa especificar uma hora para o backup!", vbCritical
  1389.         SSTab1.Tab = 0
  1390.         MaskEdBox1.SetFocus
  1391.         GoTo erro
  1392.     ElseIf OptionButton2 And MaskEdBox2.Text = "__:__" Then
  1393.         MsgBox "Voc
  1394.  precisa especificar um intervalo para o backup!", vbCritical
  1395.         SSTab1.Tab = 0
  1396.         MaskEdBox2.SetFocus
  1397.         GoTo erro
  1398.     End If
  1399.     VerificaErros = False
  1400.     Exit Function
  1401. erro:
  1402.     VerificaErros = True
  1403. End Function
  1404. Private Sub CheckBox2_Click(Index As Integer)
  1405.     OptionButton3.Value = False
  1406. End Sub
  1407. Private Sub Command1_Click()
  1408. On Error GoTo erro
  1409.     For NLoops = List1.ListCount - 1 To 0 Step -1
  1410.         If List1.Selected(NLoops) Then List1.RemoveItem (NLoops)
  1411.     Next NLoops
  1412.     Exit Sub
  1413. erro:
  1414.     If Err.Number = 68 Then
  1415.         MsgBox "O drive selecionado n
  1416. o est
  1417.  dispon
  1418. vel.", vbCritical
  1419.     Else
  1420.         MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1421.     End If
  1422.     Resume sa
  1423. End Sub
  1424. Private Sub Command2_Click()
  1425.     Unload Me
  1426. End Sub
  1427. Private Sub Command3_Click()
  1428.     If Not VerificaErros Then SalvaAltera
  1429. End Sub
  1430. Private Sub Command4_Click()
  1431.     If CheckBox3.Value = True Then
  1432.         Call AdicionaItem(False, True)
  1433.     Else
  1434.         Call AdicionaItem(False)
  1435.     End If
  1436. End Sub
  1437. Private Sub Command5_Click()
  1438.     AdicionaItem (True)
  1439. End Sub
  1440. Private Sub Command6_Click()
  1441.     If MsgBox("Isto efetuar
  1442.  o backup dos arquivos/diret
  1443. rios selecionados agora." & vbLf & _
  1444.         vbLf & "Deseja continuar?", vbQuestion + vbYesNo) = vbYes Then Backup
  1445.         
  1446. End Sub
  1447. Private Sub Command7_Click()
  1448.     ShellExecute hwnd, "open", WindowsDir & "Log Autobak.txt", vbNullString, vbNullString, SW_SHOW
  1449. End Sub
  1450. Private Sub Dir2_Change()
  1451.     Text1.Text = Dir2.Path
  1452.     DirDestino = Text1.Text
  1453. End Sub
  1454. Private Sub Drive1_Change()
  1455. On Error GoTo erro
  1456.     Dir1.Path = Drive1.Drive
  1457.         
  1458.     Exit Sub
  1459. erro:
  1460.     If Err.Number = 68 Then
  1461.         MsgBox "O drive selecionado n
  1462. o est
  1463.  dispon
  1464. vel.", vbCritical
  1465.         Drive1.Drive = "c:"
  1466.     Else
  1467.         MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1468.     End If
  1469.     Resume sa
  1470. End Sub
  1471. Private Sub Dir1_Change()
  1472.     File1.Path = Dir1.Path
  1473. End Sub
  1474. Private Sub Drive2_Change()
  1475. On Error GoTo erro
  1476.     Dir2.Path = Drive2.Drive
  1477.     Exit Sub
  1478. erro:
  1479.     If Err.Number = 68 Then
  1480.         MsgBox "O drive selecionado n
  1481. o est
  1482.  dispon
  1483. vel.", vbCritical
  1484.         Drive2.Drive = "c:"
  1485.     Else
  1486.         MsgBox Err.Number & vbLf & Err.Description, vbCritical
  1487.     End If
  1488.     Resume sa
  1489. End Sub
  1490. Private Sub File1_DblClick()
  1491.     AdicionaItem (True)
  1492.         
  1493. End Sub
  1494. Private Sub Form_Activate()
  1495.     If Not Padr
  1496. o Then
  1497.         MaskEdBox1.SetFocus
  1498.     Else
  1499.         MaskEdBox2.SetFocus
  1500.     End If
  1501.     DoEvents
  1502.     If Not SemArqIni Then Me.WindowState = vbMinimized
  1503. End Sub
  1504. Private Sub Form_Initialize()
  1505.     If App.PrevInstance Then
  1506.         MsgBox "J
  1507.  existe outra c
  1508. pia do aplicativo sendo executada!", vbCritical
  1509.         ErroAbertura = True
  1510.         Unload Me
  1511.         Set Form1 = Nothing
  1512.         End
  1513.     End If
  1514.         
  1515. End Sub
  1516. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  1517.     If ListaComFoco Then If KeyCode = 46 Then Command1_Click
  1518.         
  1519. End Sub
  1520. Private Sub Form_KeyPress(KeyAscii As Integer)
  1521.     If KeyAscii = 13 Then
  1522.         SendKeys "{TAB}"
  1523.         KeyAscii = 0
  1524.     End If
  1525. End Sub
  1526. Private Sub Form_Load()
  1527.     Dir1.Path = "C:\"
  1528.     Dir2.Path = "C:\"
  1529.     Inicializa
  1530.     With nid
  1531.         .cbSize = Len(nid)
  1532.         .hwnd = Me.hwnd
  1533.         .uId = vbNull
  1534.         .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
  1535.         .uCallBackMessage = WM_MOUSEMOVE
  1536.         .hIcon = Me.Icon
  1537.         .szTip = "Auto Backup" & vbNullChar
  1538.     End With
  1539.     Shell_NotifyIcon NIM_ADD, nid
  1540.         
  1541. End Sub
  1542. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1543.     If Me.ScaleMode = vbPixels Then
  1544.         Msg = X
  1545.     Else
  1546.         Msg = X / Screen.TwipsPerPixelX
  1547.     End If
  1548.     Select Case Msg
  1549.         Case WM_LBUTTONUP '514 restore form window
  1550.         Me.WindowState = vbNormal
  1551.         Result = SetForegroundWindow(Me.hwnd)
  1552.         Me.Show
  1553.         Case WM_LBUTTONDBLCLK '515 restore form window
  1554.         Me.WindowState = vbNormal
  1555.         Result = SetForegroundWindow(Me.hwnd)
  1556.         Me.Show
  1557.         Case WM_RBUTTONUP '517 display popup menu
  1558.         Result = SetForegroundWindow(Me.hwnd)
  1559.         Me.PopupMenu Me.mnu_1
  1560.     End Select
  1561. End Sub
  1562. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  1563.     If ErroAbertura Then Exit Sub
  1564.     'If MsgBox("Isto encerrar
  1565.  o aplicativo." & vbLf & vbLf & "Tem certeza?", vbQuestion + vbYesNo) = vbYes Then
  1566.         Unload Me
  1567.         Shell_NotifyIcon NIM_DELETE, nid
  1568.         Set Form1 = Nothing
  1569.         End
  1570.     'Else
  1571.     '    Cancel = True
  1572.     'End If
  1573. End Sub
  1574. Private Sub Form_Resize()
  1575.     If Me.WindowState = vbMinimized Then Me.Hide
  1576. End Sub
  1577. Private Sub Label16_Click()
  1578.     ShellExecute hwnd, "open", "mailto:alb@cwb.matrix.com.br", vbNullString, vbNullString, SW_SHOW
  1579. End Sub
  1580. Private Sub List1_GotFocus()
  1581.     ListaComFoco = True
  1582. End Sub
  1583. Private Sub List1_LostFocus()
  1584.     ListaComFoco = False
  1585. End Sub
  1586. Private Sub MaskEdBox1_GotFocus()
  1587.     FocalizaCampo
  1588.     MskErr1 = False
  1589.     OptionButton1.Value = True
  1590. End Sub
  1591. Private Sub MaskEdBox1_LostFocus()
  1592. On Error GoTo erro
  1593.     If MskErr2 Or MaskEdBox1.Text = "__:__" Then Exit Sub
  1594.     HoraIn
  1595. cio = TimeSerial(Hour(MaskEdBox1.Text), Minute(MaskEdBox1.Text), 0)
  1596.             
  1597.     Exit Sub
  1598. erro:
  1599.     If Err.Number = 13 Then
  1600.         MsgBox "Hora inv
  1601. lida.", vbCritical
  1602.     Else
  1603.         MsgBox Err.Number & vbLf & Err.Description
  1604.     End If
  1605.     MskErr1 = True
  1606.     MaskEdBox1.SetFocus
  1607.     HoraIn
  1608. cio = vbEmpty
  1609.     Resume sa
  1610. End Sub
  1611. Private Sub MaskEdBox2_GotFocus()
  1612.     OptionButton2.Value = True
  1613.     FocalizaCampo
  1614.     MskErr2 = False
  1615. End Sub
  1616. Sub FocalizaCampo()
  1617.     Screen.ActiveForm.ActiveControl.SelStart = 0
  1618.     Screen.ActiveForm.ActiveControl.SelLength = Len(Screen.ActiveForm.ActiveControl.Text)
  1619. End Sub
  1620. Private Sub MaskEdBox2_LostFocus()
  1621. On Error GoTo erro
  1622.     If MskErr1 Then Exit Sub
  1623.     If MaskEdBox2.Text = "__:__" Then
  1624.         OptionButton1.Value = True
  1625.         HoraIn
  1626. cio = "00:00"
  1627.         GoTo sa
  1628.     End If
  1629.     Intervalo = TimeSerial(Hour(MaskEdBox2.Text), Minute(MaskEdBox2.Text), 0)
  1630.     Exit Sub
  1631. erro:
  1632.     If Err.Number = 13 Then
  1633.         MsgBox "Intervalo inv
  1634. lido.", vbCritical
  1635.     Else
  1636.         MsgBox Err.Number & vbLf & Err.Description
  1637.     End If
  1638.     MskErr2 = True
  1639.     Intervalo = vbEmpty
  1640.     MaskEdBox2.SetFocus
  1641.     Resume sa
  1642. End Sub
  1643. Private Sub MnuBackup_Click()
  1644.     Command6_Click
  1645. End Sub
  1646. Private Sub MnuRestaurar_Click()
  1647.     Me.WindowState = vbNormal
  1648.     Result = SetForegroundWindow(Me.hwnd)
  1649.     Me.Show
  1650. End Sub
  1651. Private Sub MnuSair_Click()
  1652.     Unload Me
  1653. End Sub
  1654. Private Sub OptionButton1_Click()
  1655.     MaskEdBox1.SetFocus
  1656. End Sub
  1657. Private Sub OptionButton2_Click()
  1658.     MaskEdBox2.SetFocus
  1659. End Sub
  1660. Private Sub OptionButton3_Click()
  1661.     For NLoops = 1 To 7
  1662.         CheckBox2(NLoops).Value = False
  1663.     Next NLoops
  1664.     OptionButton3.Value = True
  1665. End Sub
  1666. Private Sub Text1_GotFocus()
  1667.     FocalizaCampo
  1668. End Sub
  1669. Private Sub Timer1_Timer()
  1670.     If Intervalo = vbEmpty And HoraIn
  1671. cio = vbEmpty Then Exit Sub
  1672.         
  1673.     If Not OptionButton3 Then
  1674.         For NLoopsTimer = 1 To 7
  1675.             If CheckBox2(NLoopsTimer).Value = True Then If Format(Date, "w") = NLoopsTimer Then ChecaHora
  1676.         Next NLoopsTimer
  1677.     Else
  1678.         ChecaHora
  1679.     End If
  1680.         
  1681. End Sub
  1682.